Bug 164002 - query scripts don't work uninstalled on windows
authorTor Lillqvist <tml@iki.fi>
Tue, 13 Jan 2009 11:17:25 +0000 (11:17 +0000)
committerTor Lillqvist <tml@src.gnome.org>
Tue, 13 Jan 2009 11:17:25 +0000 (11:17 +0000)
2009-01-12  Tor Lillqvist  <tml@iki.fi>

Bug 164002 - query scripts don't work uninstalled on windows

* queryloaders.c (main): Use the configure-time PIXBUF_LIBDIR if
the exe is located in a .libs folder, i.e. run in the build
directory through a libtool wrapper script or wrapper executable,
or in the source folder itself. Otherwise continue to infer the
runtime prefix from the exe's location.

2009-01-12  Tor Lillqvist  <tml@iki.fi>

* queryloaders.c (main): Remove the Win9x code path. It had been
left by mistake. Win9x code is gone from the rest of GTK+ since
2.12.

svn path=/trunk/; revision=22106

gdk-pixbuf/ChangeLog
gdk-pixbuf/queryloaders.c

index d50d57e48144016942715866ab72c98a97b9bd24..ffeeb1892e2503355c5211009396de7d5882b6d0 100644 (file)
@@ -1,3 +1,19 @@
+2009-01-12  Tor Lillqvist  <tml@iki.fi>
+
+       Bug 164002 - query scripts don't work uninstalled on windows
+
+       * queryloaders.c (main): Use the configure-time PIXBUF_LIBDIR if
+       the exe is located in a .libs folder, i.e. run in the build
+       directory through a libtool wrapper script or wrapper executable,
+       or in the source folder itself. Otherwise continue to infer the
+       runtime prefix from the exe's location.
+
+2009-01-12  Tor Lillqvist  <tml@iki.fi>
+
+       * queryloaders.c (main): Remove the Win9x code path. It had been
+       left by mistake. Win9x code is gone from the rest of GTK+ since
+       2.12.
+
 2009-01-07  Matthias Clasen  <mclasen@redhat.com>
 
        Bug 566862 – pixbuf_new_from_file does not autodetect format
index e0850f71588eefbc99017c24e9537035de8efe7a..ba81638992b128a82e4400e32a769476dc510d28 100644 (file)
@@ -230,27 +230,33 @@ int main (int argc, char **argv)
                 * subdirectory of the installation directory, or in
                 * the installation directory itself.
                 */
-               if (G_WIN32_HAVE_WIDECHAR_API ()) {
-                       wchar_t fn[1000];
-                       GetModuleFileNameW (NULL, fn, G_N_ELEMENTS (fn));
-                       runtime_prefix = g_utf16_to_utf8 (fn, -1, NULL, NULL, NULL);
-               }
-               else {
-                       char fn[1000];
-                       GetModuleFileNameA (NULL, fn, G_N_ELEMENTS (fn));
-                       runtime_prefix = g_locale_to_utf8 (fn, -1, NULL, NULL, NULL);
-               }
+               wchar_t fn[1000];
+               GetModuleFileNameW (NULL, fn, G_N_ELEMENTS (fn));
+               runtime_prefix = g_utf16_to_utf8 (fn, -1, NULL, NULL, NULL);
                slash = strrchr (runtime_prefix, '\\');
                *slash = '\0';
                slash = strrchr (runtime_prefix, '\\');
-               if (slash != NULL && g_ascii_strcasecmp (slash + 1, "bin") == 0) {
-                       *slash = '\0';
+               /* If running from some weird location, or from the
+                * build directory (either in the .libs folder where
+                * libtool places the real executable when using a
+                * wrapper, or directly from the gdk-pixbuf folder),
+                * use the compile-time libdir.
+                */
+               if (slash == NULL ||
+                   g_ascii_strcasecmp (slash + 1, ".libs") == 0 ||
+                   g_ascii_strcasecmp (slash + 1, "gdk-pixbuf") == 0) {
+                       libdir = PIXBUF_LIBDIR;
                }
+               else {
+                       if (slash != NULL && g_ascii_strcasecmp (slash + 1, "bin") == 0) {
+                               *slash = '\0';
+                       }
                
-               libdir = g_strconcat (runtime_prefix,
-                                     "/",
-                                     PIXBUF_LIBDIR + strlen (GTK_PREFIX) + 1,
-                                     NULL);
+                       libdir = g_strconcat (runtime_prefix,
+                                             "/",
+                                             PIXBUF_LIBDIR + strlen (GTK_PREFIX) + 1,
+                                             NULL);
+               }
        }
        else {
                libdir = PIXBUF_LIBDIR;